
package com.probiz.estore.common.model.order.base;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.order.SalesOrder;
import com.probiz.estore.core.model.BaseObject;

/**
 * OrderPayment Base Java Bean, base class for the model, mapped directly to
 * database table
 * 
 * Avoid changing this file if not necessary, will be overwritten.
 * 
 */
public class OrderPaymentTbl extends BaseObject implements Serializable {

	protected Integer		orderPaymentId;
	/**
	 * 单据类型 1=收款单 0=退款单
	 */
	protected Short			documentType;
	/**
	 * 收/退款单号
	 */
	protected String		documentNo;
	/**
	 * 收/退款金额
	 */
	protected BigDecimal	paymentAmount;
	/**
	 * 手续费
	 */
	protected BigDecimal	commission;
	/**
	 * 支付网关名称
	 */
	protected String		paymentGatewayName;
	/**
	 * 支付方式id，用于前台支付跳转
	 */
	protected Integer		paymentMethodId;
	/**
	 * 支付方式类型(货到付款、自提) 1=现金 2=POS刷卡 3=支票
	 */
	protected Short			paymentType;
	/**
	 * 支付方式的描述，例如 货到付款 现金支付,货到付款 POS刷卡支付,在线支付,银行卡转账,邮局汇款,自提 支票支付
	 */
	protected String		paymentTypeDesc;
	/**
	 * 是否需要发票
	 */
	protected Short			hasInvoice;
	/**
	 * 发票抬头
	 */
	protected String		invoiceTitle;
	/**
	 * ip地址
	 */
	protected String		ipAddress;
	/**
	 * 支付礼券号码
	 */
	protected String		giftCertificateNo;
	/**
	 * 支付所使用的积分数量
	 */
	protected Integer		usedShopPoint;
	/**
	 * 收/退款账号信息： 例如 开户行：中国农业银行广州黄花岗支行 银行户名：广州博商贸易有限公司 银行帐号：1111 2222 3333 4444
	 * 5555
	 * 
	 * 或 商户客户账号：1234567890 收款客户：广州博商贸易有限公司
	 */
	protected String		accountInfo;
	/**
	 * 退款原因
	 */
	protected String		returnReason;
	/**
	 * 备注
	 */
	protected String		memo;
	/**
	 * 付款人姓名
	 */
	protected String		payer;
	/**
	 * 收款人姓名
	 */
	protected String		payee;
	/**
	 * 收/退款时间
	 */
	protected Date			payTime;
	protected Date			createTime;
	protected Date			updateTime;
	protected Integer		createBy;
	protected Integer		updateBy;
	protected Integer		version;
	/**
	 * 指向销售订单
	 */
	protected SalesOrder	salesOrder;

	/**
	 * Default Empty Constructor for class OrderPayment
	 */
	public OrderPaymentTbl() {
		super();
	}

	/**
	 * Default Key Fields Constructor for class OrderPayment
	 */
	public OrderPaymentTbl(Integer in_orderPaymentId) {
		this.setOrderPaymentId(in_orderPaymentId);
	}

	public SalesOrder getSalesOrder() {
		return salesOrder;
	}

	public void setSalesOrder(SalesOrder in_salesOrder) {
		this.salesOrder = in_salesOrder;
	}

	/**
	 * *
	 * 
	 * @return Integer
	 * @hibernate.id column="orderPaymentId" type="java.lang.Integer"
	 *               generator-class="native"
	 */
	public Integer getOrderPaymentId() {
		return this.orderPaymentId;
	}

	/**
	 * Set the orderPaymentId
	 */
	public void setOrderPaymentId(Integer aValue) {
		this.orderPaymentId = aValue;
	}

	/**
	 * *
	 * 
	 * @return Integer
	 */
	public Integer getSalesOrderId() {
		return this.getSalesOrder() == null ? null : this.getSalesOrder()
				.getSalesOrderId();
	}

	/**
	 * Set the salesOrderId
	 */
	public void setSalesOrderId(Integer aValue) {
		if (aValue == null) {
			salesOrder = null;
		} else {
			salesOrder = new SalesOrder(aValue);
			salesOrder.setVersion(Integer.valueOf(0));// set a version to cheat
			// hibernate only
		}
	}

	/**
	 * 单据类型 1=收款单 0=退款单 *
	 * 
	 * @return Short
	 * @hibernate.property column="documentType" type="java.lang.Short"
	 *                     length="5" not-null="true" unique="false"
	 */
	public Short getDocumentType() {
		return this.documentType;
	}

	/**
	 * Set the documentType
	 * 
	 * @spring.validator type="required"
	 */
	public void setDocumentType(Short aValue) {
		this.documentType = aValue;
	}

	public String getDocumentNo() {
		return documentNo;
	}

	public void setDocumentNo(String documentNo) {
		this.documentNo = documentNo;
	}

	/**
	 * 收/退款金额 *
	 * 
	 * @return BigDecimal
	 * @hibernate.property column="paymentAmount" type="BigDecimal" length="12"
	 *                     not-null="true" unique="false"
	 */
	public BigDecimal getPaymentAmount() {
		return this.paymentAmount;
	}

	/**
	 * Set the paymentAmount
	 * 
	 * @spring.validator type="required"
	 */
	public void setPaymentAmount(BigDecimal aValue) {
		this.paymentAmount = aValue;
	}

	/**
	 * 手续费 *
	 * 
	 * @return BigDecimal
	 * @hibernate.property column="commission" type="BigDecimal" length="12"
	 *                     not-null="false" unique="false"
	 */
	public BigDecimal getCommission() {
		return this.commission;
	}

	/**
	 * Set the commission
	 */
	public void setCommission(BigDecimal aValue) {
		this.commission = aValue;
	}

	/**
	 * 支付网关名称 *
	 * 
	 * @return String
	 * @hibernate.property column="paymentGatewayName" type="java.lang.String"
	 *                     length="256" not-null="false" unique="false"
	 */
	public String getPaymentGatewayName() {
		return this.paymentGatewayName;
	}

	/**
	 * Set the paymentGatewayName
	 */
	public void setPaymentGatewayName(String aValue) {
		this.paymentGatewayName = aValue;
	}

	/**
	 * 支付方式id，用于前台支付跳转 *
	 * 
	 * @return Integer
	 * @hibernate.property column="paymentMethodId" type="java.lang.Integer"
	 *                     length="10" not-null="false" unique="false"
	 */
	public Integer getPaymentMethodId() {
		return this.paymentMethodId;
	}

	/**
	 * Set the paymentMethodId
	 */
	public void setPaymentMethodId(Integer aValue) {
		this.paymentMethodId = aValue;
	}

	
	public Short getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(Short paymentType) {
		this.paymentType = paymentType;
	}

	public String getPaymentTypeDesc() {
		return paymentTypeDesc;
	}

	public void setPaymentTypeDesc(String paymentTypeDesc) {
		this.paymentTypeDesc = paymentTypeDesc;
	}

	/**
	 * 是否需要发票 *
	 * 
	 * @return Short
	 * @hibernate.property column="hasInvoice" type="java.lang.Short" length="5"
	 *                     not-null="true" unique="false"
	 */
	public Short getHasInvoice() {
		return this.hasInvoice;
	}

	/**
	 * Set the hasInvoice
	 * 
	 * @spring.validator type="required"
	 */
	public void setHasInvoice(Short aValue) {
		this.hasInvoice = aValue;
	}

	/**
	 * 发票抬头 *
	 * 
	 * @return String
	 * @hibernate.property column="invoiceTitle" type="java.lang.String"
	 *                     length="128" not-null="false" unique="false"
	 */
	public String getInvoiceTitle() {
		return this.invoiceTitle;
	}

	/**
	 * Set the invoiceTitle
	 */
	public void setInvoiceTitle(String aValue) {
		this.invoiceTitle = aValue;
	}

	/**
	 * ip地址 *
	 * 
	 * @return String
	 * @hibernate.property column="ipAddress" type="java.lang.String"
	 *                     length="64" not-null="false" unique="false"
	 */
	public String getIpAddress() {
		return this.ipAddress;
	}

	/**
	 * Set the ipAddress
	 */
	public void setIpAddress(String aValue) {
		this.ipAddress = aValue;
	}

	/**
	 * 支付礼券号码 *
	 * 
	 * @return String
	 * @hibernate.property column="giftCertificateNo" type="java.lang.String"
	 *                     length="32" not-null="false" unique="false"
	 */
	public String getGiftCertificateNo() {
		return this.giftCertificateNo;
	}

	/**
	 * Set the giftCertificateNo
	 */
	public void setGiftCertificateNo(String aValue) {
		this.giftCertificateNo = aValue;
	}

	/**
	 * 支付所使用的积分数量 *
	 * 
	 * @return Integer
	 * @hibernate.property column="usedShopPoint" type="java.lang.Integer"
	 *                     length="10" not-null="false" unique="false"
	 */
	public Integer getUsedShopPoint() {
		return this.usedShopPoint;
	}

	/**
	 * Set the usedShopPoint
	 */
	public void setUsedShopPoint(Integer aValue) {
		this.usedShopPoint = aValue;
	}

	/**
	 * 收/退款账号信息： 例如 开户行：中国农业银行广州黄花岗支行 银行户名：广州博商贸易有限公司 银行帐号：1111 2222 3333 4444
	 * 5555
	 * 
	 * 或 商户客户账号：1234567890 收款客户：广州博商贸易有限公司
	 * 
	 * @return String
	 * @hibernate.property column="accountInfo" type="java.lang.String"
	 *                     length="512" not-null="false" unique="false"
	 */
	public String getAccountInfo() {
		return this.accountInfo;
	}

	/**
	 * Set the accountInfo
	 */
	public void setAccountInfo(String aValue) {
		this.accountInfo = aValue;
	}

	/**
	 * 退款原因 *
	 * 
	 * @return String
	 * @hibernate.property column="returnReason" type="java.lang.String"
	 *                     length="512" not-null="false" unique="false"
	 */
	public String getReturnReason() {
		return this.returnReason;
	}

	/**
	 * Set the returnReason
	 */
	public void setReturnReason(String aValue) {
		this.returnReason = aValue;
	}

	/**
	 * 备注 *
	 * 
	 * @return String
	 * @hibernate.property column="memo" type="java.lang.String" length="1024"
	 *                     not-null="false" unique="false"
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 * Set the memo
	 */
	public void setMemo(String aValue) {
		this.memo = aValue;
	}

	/**
	 * 付款人姓名 *
	 * 
	 * @return String
	 * @hibernate.property column="payer" type="java.lang.String" length="32"
	 *                     not-null="false" unique="false"
	 */
	public String getPayer() {
		return this.payer;
	}

	/**
	 * Set the payer
	 */
	public void setPayer(String aValue) {
		this.payer = aValue;
	}

	/**
	 * 收款人姓名 *
	 * 
	 * @return String
	 * @hibernate.property column="payee" type="java.lang.String" length="32"
	 *                     not-null="false" unique="false"
	 */
	public String getPayee() {
		return this.payee;
	}

	/**
	 * Set the payee
	 */
	public void setPayee(String aValue) {
		this.payee = aValue;
	}

	/**
	 * 收/退款时间 *
	 * 
	 * @return Date
	 * @hibernate.property column="payTime" type="Date" length="19"
	 *                     not-null="false" unique="false"
	 */
	public Date getPayTime() {
		return this.payTime;
	}

	/**
	 * Set the payTime
	 */
	public void setPayTime(Date aValue) {
		this.payTime = aValue;
	}

	/**
	 * *
	 * 
	 * @return Date
	 * @hibernate.property column="createTime" type="Date" length="19"
	 *                     not-null="true" unique="false"
	 */
	public Date getCreateTime() {
		return this.createTime;
	}

	/**
	 * Set the createTime
	 * 
	 * @spring.validator type="required"
	 */
	public void setCreateTime(Date aValue) {
		this.createTime = aValue;
	}

	/**
	 * *
	 * 
	 * @return Date
	 * @hibernate.property column="updateTime" type="Date" length="19"
	 *                     not-null="true" unique="false"
	 */
	public Date getUpdateTime() {
		return this.updateTime;
	}

	/**
	 * Set the updateTime
	 * 
	 * @spring.validator type="required"
	 */
	public void setUpdateTime(Date aValue) {
		this.updateTime = aValue;
	}

	/**
	 * *
	 * 
	 * @return Integer
	 * @hibernate.property column="createBy" type="java.lang.Integer"
	 *                     length="10" not-null="false" unique="false"
	 */
	public Integer getCreateBy() {
		return this.createBy;
	}

	/**
	 * Set the createBy
	 */
	public void setCreateBy(Integer aValue) {
		this.createBy = aValue;
	}

	/**
	 * *
	 * 
	 * @return Integer
	 * @hibernate.property column="updateBy" type="java.lang.Integer"
	 *                     length="10" not-null="false" unique="false"
	 */
	public Integer getUpdateBy() {
		return this.updateBy;
	}

	/**
	 * Set the updateBy
	 */
	public void setUpdateBy(Integer aValue) {
		this.updateBy = aValue;
	}

	/**
	 * *
	 * 
	 * @return Integer
	 * @hibernate.property column="version" type="java.lang.Integer" length="10"
	 *                     not-null="false" unique="false"
	 */
	public Integer getVersion() {
		return this.version;
	}

	/**
	 * Set the version
	 */
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof OrderPaymentTbl)) {
			return false;
		}
		OrderPaymentTbl rhs = (OrderPaymentTbl) object;
		return new EqualsBuilder().append(this.orderPaymentId,
				rhs.orderPaymentId).append(this.documentType, rhs.documentType)
				.append(this.paymentAmount, rhs.paymentAmount).append(
						this.commission, rhs.commission).append(
						this.paymentGatewayName, rhs.paymentGatewayName)
				.append(this.paymentMethodId, rhs.paymentMethodId).append(
						this.paymentType, rhs.paymentType).append(
						this.hasInvoice, rhs.hasInvoice).append(
						this.invoiceTitle, rhs.invoiceTitle).append(
						this.ipAddress, rhs.ipAddress).append(
						this.giftCertificateNo, rhs.giftCertificateNo).append(
						this.usedShopPoint, rhs.usedShopPoint).append(
						this.accountInfo, rhs.accountInfo).append(
						this.returnReason, rhs.returnReason).append(this.memo,
						rhs.memo).append(this.payer, rhs.payer).append(
						this.payee, rhs.payee)
				.append(this.payTime, rhs.payTime).append(this.createTime,
						rhs.createTime).append(this.updateTime, rhs.updateTime)
				.append(this.createBy, rhs.createBy).append(this.updateBy,
						rhs.updateBy).append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973).append(
				this.orderPaymentId).append(this.documentType).append(
				this.paymentAmount).append(this.commission).append(
				this.paymentGatewayName).append(this.paymentMethodId).append(
				this.paymentType).append(this.hasInvoice).append(
				this.invoiceTitle).append(this.ipAddress).append(
				this.giftCertificateNo).append(this.usedShopPoint).append(
				this.accountInfo).append(this.returnReason).append(this.memo)
				.append(this.payer).append(this.payee).append(this.payTime)
				.append(this.createTime).append(this.updateTime).append(
						this.createBy).append(this.updateBy).append(
						this.version).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("orderPaymentId",
				this.orderPaymentId).append("documentType", this.documentType)
				.append("paymentAmount", this.paymentAmount).append(
						"commission", this.commission).append(
						"paymentGatewayName", this.paymentGatewayName).append(
						"paymentMethodId", this.paymentMethodId).append(
						"paymentType", this.paymentType).append("hasInvoice",
						this.hasInvoice).append("invoiceTitle",
						this.invoiceTitle).append("ipAddress", this.ipAddress)
				.append("giftCertificateNo", this.giftCertificateNo).append(
						"usedShopPoint", this.usedShopPoint).append(
						"accountInfo", this.accountInfo).append("returnReason",
						this.returnReason).append("memo", this.memo).append(
						"payer", this.payer).append("payee", this.payee)
				.append("payTime", this.payTime).append("createTime",
						this.createTime).append("updateTime", this.updateTime)
				.append("createBy", this.createBy).append("updateBy",
						this.updateBy).append("version", this.version)
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "orderPaymentId";
	}

	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return orderPaymentId;
	}

}